<?php
header('content-type:text/html;charset=utf-8');
session_start();
require 'config.php';
error_reporting(5);
error_reporting(E_ALL & ~E_NOTICE);
error_reporting(0);
//身份验证
session_start();
if (!isset($_SESSION['login'])) {
	header('Refresh:2;url=login/index.php');
	echo "你还没有登陆！";
	die();
}

$email=$_SESSION['login'];
$query_email="SELECT * FROM users WHERE `uemail`='$email'";
$result_email=mysqli_query($config,$query_email);
$row_email=mysqli_fetch_array($result_email);
$id=$row_email['userid'];

$xname=$_POST['xname'];
$xtel=$_POST['xtel'];
$xaddress=$_POST['xaddress'];
// var_dump($id);

// $content=trim($_POST['content']);
//验证合法性
// if (empty($xtel) || empty($xaddress)) {
// 	echo ('<script type="text/javascript">alert("电话和地址不能为空！");
//      			window.history.back(-1);
//      			</script>');
// 	die();
// }

include_once('dbtools.php');
$link=create_connection();
$sql="update users set uname='{$xname}',uphone='{$xtel}',uaddress='{$xaddress}'where userid='{$id}' ";
$res=excult_sql($link,'school',$sql);
header('Refresh:2;url=information.php');
	echo '修改成功！';
// 	die();
	?>